{% extends "park/base.html" %}

{% block css %}
{% endblock %}

{% block content %}
<script type="text/javascript">
var primary_menu = "menu_4";
var sub_menu = "menu_4_1";
</script>

    <div class="col-md-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <div class="panel-title"><h3>污染防治基本信息</h3></div>
                <div class="panel-options">
                	<form role="form" action="" method="get" enctype="" class="form-horizontal pull-left">
                	
                	
                		<div class="form-group" style="margin-right: 10px">
                             <label class="control-label">污染物名称：</label>
                             <div>
                             	<input name="key_environmental_name" type="text" />
                             </div>
                         </div>
                         
                         <div class="form-group" style="margin-right: 10px">
                             <label class="control-label">是否为危化品：</label>
                             <div>
                             	<select name="key_environmental_kind" datatype="*">
                             		<option value="">--请选择--</option>
                                    <option value="1">重点环境管理危险化学品</option>
                                    <option value="2" selected="selected">特征化学污染物</option>
                                </select>
                             </div>       
                         </div>
                         
                         
                         <div class="form-group" style="margin-right: 10px">
                             <label class="control-label">排序：</label>
                             <div>
                             	<select name="orderby">
                             		<option value="">--请选择--</option>
                             		<option value="key_environmental_name">污染物名称</option>
                             		<option value="com">公司名称</option>
                             	</select>
                             </div>
                         </div>
                         
						                         
                	 	<div class="form-group" style="margin-right: 10px">
                             <label class="control-label">公司：</label>
                             <div>
                             	<input id='f_company' name="com" class="time company" type="text" />
                             </div>
                         </div>
                         <div class="form-group filter-btn">
                            <input type="submit" class="btn btn-success" value="筛选">
                         </div>
                     </form>
                    <!-- <a href="#" data-rel="reload"><i class="entypo-arrows-ccw"></i></a> -->
                 </div>
            </div>
           <div class="panel-body with-table">
                        <table class="table table-bordered table-responsive">
                            <thead>
                            <tr>
                                <th>污染物名称</th>
                                <th>是否为危化品</th>
                                <!-- <th>释放途径</th>
                                <th>转移去向</th>
                                <th>废物名称</th> -->
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for key in list%}
	                            <tr>
	                                <td>{{key.key_environmental_name}}</td>
	                                {%if key.key_environmental_kind == 1 %}
	                                <td >重点环境管理危险化学品</td>
	                                {%else%}
	                                <td >特征化学污染物</td>
	                                {% endif %}
	                            <!--     <td>{{key.key_environmental_name}}</td>
	                                <td>{{key.key_environmental_name}}</td>
	                                <td>{{key.key_environmental_name}}</td> -->
	                                <td>
	                                    <a href="/park/transferDetail/?id={{key.id}}" class="btn btn-success">查看</a>
	                                </td>
	                            </tr>
	                        {% endfor %}    
                            </tbody>
                        </table>
                        <div class="row">
                            <div class="col-xs-6 col-left">
                                <div class="dataTables_info" id="table-3_info"></div>
                            </div>
                            <div class="col-xs-6 col-right">
                                <div class="dataTables_paginate paging_bootstrap" style="text-align: right;margin-right: 10px">
                                    <ul class="pagination pagination-sm" >
                                        {% if cs.has_previous %}
                                            <li><a href="?page={{ cs.previous_page_number }}">上一页</a></li>
                                        {% else %}
                                            <li class="disabled"> <span>上一页</span></li>
                                        {% endif %}
                                        {% for p in paginator.page_range %}
                                            {% ifequal p cs.number %}
                                                <li class="active"> <span class="p">{{p}}</span></li>
                                            {% else%}
                                                <li> <a href="?page={{ p }}">{{p}}</a></li>
                                            {% endifequal %}
                                        {% endfor %}
                                        {% if cs.has_next %}
                                            <li class="next">  <a href="?page={{ cs.next_page_number }}">下一页</a></li>
                                        {% else %}
                                            <li class="disabled"><span>下一页</span></li>
                                        {% endif %}
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>

            </div>

        </div>
  


{% endblock %}

{% block js %}

<script src="/static/js/date-choose.js"></script>
<script language="javascript">

		var ep_data = [
               {% for e in coms %}
                   { "id":{{ e.id }}, "value": "{{ e.name }}", "label": "{{ e.name }}" },
               {% endfor %}
           ];

           $(function () {
               $('#f_company').bind('click',function(){
                   $('#f_company')[0].setAttribute('eid', '');
                   console.log(123);
               })

               $('#f_company').autocompleter({ 
                   source: ep_data,
                   limit: 5,
                   callback: function (value, index) {
                       $('#f_company')[0].setAttribute('eid', ep_data[index].id);
                   }
               });
           });

    function getNextElement (field) {
        var form = field.form;
        for (var e = 0; e < form.elements.length; e++)
            if (field == form.elements[e])
                break;

        return form.elements[++e % form.elements.length];
    }
    function tabOnEnter (field, evt) {
        var keyCode = document.layers ? evt.which : document.all ?
                evt.keyCode : evt.keyCode;
        if (field.value.length == 1){
            getNextElement(field).focus();
            return false;
        }
    }
</script>
{% endblock %}